package net.dgg.zz.common.base.entity;

import net.dgg.tmd.foundation.platform.user.entity.UserEntity;

import java.util.Date;


/**
 * 基础实体类，所有的实体都应该继承该类，并对该类中的内容进行维护
 *
 * @author nature
 * @create 2018-04-12 9:25
 */
public class BaseEntity {

    /**
     * 实体ID，推荐由DggKeyWorker生成，是实体的唯一标志
     */
    protected Long id;

    /**
     * 创建者用户ID，如果是系统创建的，使用用户ID 1
     */
    protected Long createrId;
    /**
     * 创建者用户名称，使用创建者的登录名记录
     */
    protected String createrName;
    /**
     * 创建时间
     */
    protected Date createTime;
    /**
     * 创建部门
     */
    protected Long createrOrgId;
    /**
     * 修改者用户ID，如果是系统修改的，使用用户ID 1
     */
    protected Long updaterId;
    /**
     * 修改者用户名称，使用修改者的登录名记录
     */
    protected String updaterName;
    /**
     * 修改时间
     */
    protected Date updateTime;
    /**
     * 更新部门
     */
    protected Long updaterOrgId;

    /**
     * 创建人部门
     */
    private String createrOrgName;
    
    /**
     * 功能描述: 
     * @Description 修改人部门
     * @param 
     * @return 
     * @throws 
     * @author cting
     * @date 2018/8/13  10:29
     * @version V1.0
     */
    private String updaterOrgName;


    /**
     * 设置创建人ID,创建人姓名,创建时间(当前)
     *
     * @param user 用户User
     * @author: hanfeng
     */
    public void setCreateUser(UserEntity user) {
        this.createTime = new Date();
        if (null != user) {
            this.createrId = user.getId();
            this.createrName = user.getRealName() +"/"+ user.getLoginName();
            this.createrOrgId = user.getOrgId();
        }
    }

    /**
     * 设置修改人ID,修改人姓名,修改时间(当前)
     *
     * @param user
     * @author: hanfeng
     */
    public void setUpdaterUser(UserEntity user) {
        this.updateTime = new Date();
        if (null != user) {
            this.updaterId = user.getId();
            this.updaterName = user.getRealName() +"/"+ user.getLoginName();
            this.updaterOrgId = user.getOrgId();
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCreaterId() {
        return createrId;
    }

    public void setCreaterId(Long createrId) {
        this.createrId = createrId;
    }

    public String getCreaterName() {
        return createrName;
    }

    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getUpdaterId() {
        return updaterId;
    }

    public void setUpdaterId(Long updaterId) {
        this.updaterId = updaterId;
    }

    public String getUpdaterName() {
        return updaterName;
    }

    public void setUpdaterName(String updaterName) {
        this.updaterName = updaterName;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getCreaterOrgId() {
        return createrOrgId;
    }

    public void setCreaterOrgId(Long createrOrgId) {
        this.createrOrgId = createrOrgId;
    }

    public Long getUpdaterOrgId() {
        return updaterOrgId;
    }

    public void setUpdaterOrgId(Long updaterOrgId) {
        this.updaterOrgId = updaterOrgId;
    }

    public String getCreaterOrgName() {
        return createrOrgName;
    }

    public void setCreaterOrgName(String createrOrgName) {
        this.createrOrgName = createrOrgName;
    }

    public String getUpdaterOrgName() {
        return updaterOrgName;
    }

    public void setUpdaterOrgName(String updaterOrgName) {
        this.updaterOrgName = updaterOrgName;
    }
}
